package com.xzx;

import org.junit.Test;

import java.util.Iterator;
import java.util.ServiceLoader;

/**
 *
 * @author xinzhixuan
 * @version 1.0
 * @date 2025/9/11 14:03
 */
public class ProviderTest {

    @Test
    public void test() {
        // 这里会加载文件夹下的所有META-INF/services/com.xzx.Provider中的类
        ServiceLoader<Provider> loadedProviders = ServiceLoader.load(Provider.class);
        for (Provider provider : loadedProviders) {
            System.out.println(provider);
            ProviderManager.registerProvider(provider);
        }

        Provider provider = ProviderManager.getProvider("xzx");
        System.out.println(provider);
    }
}
